package y23.Oct;

import java.util.Scanner;

public class Test29 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();
        in.nextLine();
        int n = 1;
        String a = in.nextLine();
        for (int i = 0; i < a.length(); i++) {
            if (a.charAt(i) == 'U'){
                if(n == 1) {
                    n = num;
                }else {
                    n--;
                }
            } else if (a.charAt(i) == 'D') {
                if(n == num) {
                    n = 1;
                }else {
                    n++;
                }
            }
        }
        int[] nums = {n,n+1,n+2,n+3};
        for (int i = 0; i < nums.length; i++) {
            System.out.print(nums[i]+" ");
        }
        System.out.println();
        System.out.println(n);
    }
}
